# Makefile for IEC 104 Protocol Controller Application

# 编译器设置
CC = gcc
CFLAGS = -Wall -Wextra -std=c99 -O2 -g -pthread
LDFLAGS = -pthread

# 目录设置
SRC_DIR = src
INCLUDE_DIR = include
BUILD_DIR = ../../../build/protocol/104/controller
OBJ_DIR = $(BUILD_DIR)/obj
BIN_DIR = $(BUILD_DIR)/bin

# 包含路径
INCLUDES = -I$(INCLUDE_DIR) \
           -I../../../common/logs/include \
           -I../../../common/config/include \
           -I../../../common/json/include \
           -I../../../common/utils/include \
           -I../../../common/network/include \
           -I../../../common/version/include \
           -I../../../app/common/mqtt/include \
           -I../../../app/iotplatform/include \
           -I../../../third/mqtt/src \
           -I../../../third/cJSON \
           -I../../../drivers/net/include \
           -I../core \
           -I../core/common/types/include \
           -I../core/common/utils/include \
           -I../core/common/error/include \
           -I../core/common/version/include \
           -I../core/protocol/apdu/include \
           -I../core/protocol/asdu/include \
           -I../core/data/telemetry/include \
           -I../core/data/analog/include \
           -I../core/data/control/include \
           -I../core/data/energy/include \
           -I../core/data/pulse/include \
           -I../core/data/system/include \
           -I../core/control/validator/include \
           -I../core/control/statemachine/include \
           -I../core/control/timeout/include \
           -I../core/control/sequence/include \
           -I../core/control/connection/include \
           -I../core/transfer/file/include \
           -I../core/transfer/upgrade/include \
           -I../core/parameter/include \
           -I../core/api/include \
           -I../core/transport/include

# Controller源文件
CONTROLLER_SOURCES = $(wildcard $(SRC_DIR)/*.c)
CONTROLLER_OBJECTS = $(CONTROLLER_SOURCES:$(SRC_DIR)/%.c=$(OBJ_DIR)/%.o)

# Common模块源文件
COMMON_LOGS_SRC = ../../../common/logs/src/logger.c
COMMON_CONFIG_SRC = ../../../common/config/src/cfg_utils.c
COMMON_JSON_SRC = ../../../common/json/src/json_utils.c \
                  ../../../common/json/src/param_parser.c
COMMON_UTILS_SRC = ../../../common/utils/src/string_utils.c \
                   ../../../common/utils/src/buffer_utils.c
COMMON_NETWORK_SRC = ../../../common/network/src/network_utils.c
COMMON_VERSION_SRC = ../../../common/version/src/version.c
COMMON_OBJECTS = $(BUILD_DIR)/common/logger.o \
                 $(BUILD_DIR)/common/cfg_utils.o \
                 $(BUILD_DIR)/common/json_utils.o \
                 $(BUILD_DIR)/common/param_parser.o \
                 $(BUILD_DIR)/common/string_utils.o \
                 $(BUILD_DIR)/common/buffer_utils.o \
                 $(BUILD_DIR)/common/network_utils.o \
                 $(BUILD_DIR)/common/version.o

# MQTT客户端
MQTT_SRC = ../../../app/common/mqtt/src/mqtt_client.c \
           ../../../app/common/mqtt/src/mqtt_config_loader.c
MQTT_OBJECTS = $(BUILD_DIR)/mqtt/mqtt_client.o \
               $(BUILD_DIR)/mqtt/mqtt_config_loader.o

# 平台客户端
PLATFORM_SRC = ../../../app/iotplatform/src/platform_client.c \
               ../../../app/iotplatform/src/platform_config.c
PLATFORM_OBJECTS = $(BUILD_DIR)/platform/platform_client.o \
                   $(BUILD_DIR)/platform/platform_config.o

# Drivers源文件
DRIVER_NET_SRC = ../../../drivers/net/src/transport_net.c \
                 ../../../drivers/net/src/transport_net_config.c
DRIVER_NET_OBJECTS = $(BUILD_DIR)/drivers/transport_net.o \
                     $(BUILD_DIR)/drivers/transport_net_config.o

# 104协议核心源文件
CORE_DIR = ../core
CORE_PROTOCOL_APDU_SRC = $(wildcard $(CORE_DIR)/protocol/apdu/src/*.c)
CORE_PROTOCOL_ASDU_SRC = $(wildcard $(CORE_DIR)/protocol/asdu/src/*.c)
CORE_CONTROL_VALIDATOR_SRC = $(wildcard $(CORE_DIR)/control/validator/src/*.c)
CORE_CONTROL_STATEMACHINE_SRC = $(wildcard $(CORE_DIR)/control/statemachine/src/*.c)
CORE_CONTROL_TIMEOUT_SRC = $(wildcard $(CORE_DIR)/control/timeout/src/*.c)
CORE_CONTROL_SEQUENCE_SRC = $(wildcard $(CORE_DIR)/control/sequence/src/*.c)
CORE_CONTROL_CONNECTION_SRC = $(wildcard $(CORE_DIR)/control/connection/src/*.c)
CORE_DATA_TELEMETRY_SRC = $(wildcard $(CORE_DIR)/data/telemetry/src/*.c)
CORE_DATA_ANALOG_SRC = $(wildcard $(CORE_DIR)/data/analog/src/*.c)
CORE_DATA_CONTROL_SRC = $(wildcard $(CORE_DIR)/data/control/src/*.c)
CORE_DATA_ENERGY_SRC = $(wildcard $(CORE_DIR)/data/energy/src/*.c)
CORE_DATA_PULSE_SRC = $(wildcard $(CORE_DIR)/data/pulse/src/*.c)
CORE_DATA_SYSTEM_SRC = $(wildcard $(CORE_DIR)/data/system/src/*.c)
CORE_TRANSFER_FILE_SRC = $(wildcard $(CORE_DIR)/transfer/file/src/*.c)
CORE_TRANSFER_UPGRADE_SRC = $(wildcard $(CORE_DIR)/transfer/upgrade/src/*.c)
CORE_PARAMETER_SRC = $(wildcard $(CORE_DIR)/parameter/src/*.c)
CORE_UTILS_SRC = $(wildcard $(CORE_DIR)/common/utils/src/*.c)
CORE_ERROR_SRC = $(wildcard $(CORE_DIR)/common/error/src/*.c)
CORE_TYPES_SRC = $(wildcard $(CORE_DIR)/common/types/src/*.c)
CORE_API_SRC = $(wildcard $(CORE_DIR)/api/src/*.c)
CORE_TRANSPORT_SRC = $(wildcard $(CORE_DIR)/transport/src/*.c)

CORE_PROTOCOL_APDU_OBJ = $(CORE_PROTOCOL_APDU_SRC:$(CORE_DIR)/protocol/apdu/src/%.c=$(OBJ_DIR)/core/protocol/apdu/%.o)
CORE_PROTOCOL_ASDU_OBJ = $(CORE_PROTOCOL_ASDU_SRC:$(CORE_DIR)/protocol/asdu/src/%.c=$(OBJ_DIR)/core/protocol/asdu/%.o)
CORE_CONTROL_VALIDATOR_OBJ = $(CORE_CONTROL_VALIDATOR_SRC:$(CORE_DIR)/control/validator/src/%.c=$(OBJ_DIR)/core/control/validator/%.o)
CORE_CONTROL_STATEMACHINE_OBJ = $(CORE_CONTROL_STATEMACHINE_SRC:$(CORE_DIR)/control/statemachine/src/%.c=$(OBJ_DIR)/core/control/statemachine/%.o)
CORE_CONTROL_TIMEOUT_OBJ = $(CORE_CONTROL_TIMEOUT_SRC:$(CORE_DIR)/control/timeout/src/%.c=$(OBJ_DIR)/core/control/timeout/%.o)
CORE_CONTROL_SEQUENCE_OBJ = $(CORE_CONTROL_SEQUENCE_SRC:$(CORE_DIR)/control/sequence/src/%.c=$(OBJ_DIR)/core/control/sequence/%.o)
CORE_CONTROL_CONNECTION_OBJ = $(CORE_CONTROL_CONNECTION_SRC:$(CORE_DIR)/control/connection/src/%.c=$(OBJ_DIR)/core/control/connection/%.o)
CORE_DATA_TELEMETRY_OBJ = $(CORE_DATA_TELEMETRY_SRC:$(CORE_DIR)/data/telemetry/src/%.c=$(OBJ_DIR)/core/data/telemetry/%.o)
CORE_DATA_ANALOG_OBJ = $(CORE_DATA_ANALOG_SRC:$(CORE_DIR)/data/analog/src/%.c=$(OBJ_DIR)/core/data/analog/%.o)
CORE_DATA_CONTROL_OBJ = $(CORE_DATA_CONTROL_SRC:$(CORE_DIR)/data/control/src/%.c=$(OBJ_DIR)/core/data/control/%.o)
CORE_DATA_ENERGY_OBJ = $(CORE_DATA_ENERGY_SRC:$(CORE_DIR)/data/energy/src/%.c=$(OBJ_DIR)/core/data/energy/%.o)
CORE_DATA_PULSE_OBJ = $(CORE_DATA_PULSE_SRC:$(CORE_DIR)/data/pulse/src/%.c=$(OBJ_DIR)/core/data/pulse/%.o)
CORE_DATA_SYSTEM_OBJ = $(CORE_DATA_SYSTEM_SRC:$(CORE_DIR)/data/system/src/%.c=$(OBJ_DIR)/core/data/system/%.o)
CORE_TRANSFER_FILE_OBJ = $(CORE_TRANSFER_FILE_SRC:$(CORE_DIR)/transfer/file/src/%.c=$(OBJ_DIR)/core/transfer/file/%.o)
CORE_TRANSFER_UPGRADE_OBJ = $(CORE_TRANSFER_UPGRADE_SRC:$(CORE_DIR)/transfer/upgrade/src/%.c=$(OBJ_DIR)/core/transfer/upgrade/%.o)
CORE_PARAMETER_OBJ = $(CORE_PARAMETER_SRC:$(CORE_DIR)/parameter/src/%.c=$(OBJ_DIR)/core/parameter/%.o)
CORE_UTILS_OBJ = $(CORE_UTILS_SRC:$(CORE_DIR)/common/utils/src/%.c=$(OBJ_DIR)/core/common/utils/%.o)
CORE_ERROR_OBJ = $(CORE_ERROR_SRC:$(CORE_DIR)/common/error/src/%.c=$(OBJ_DIR)/core/common/error/%.o)
CORE_TYPES_OBJ = $(CORE_TYPES_SRC:$(CORE_DIR)/common/types/src/%.c=$(OBJ_DIR)/core/common/types/%.o)
CORE_API_OBJ = $(CORE_API_SRC:$(CORE_DIR)/api/src/%.c=$(OBJ_DIR)/core/api/%.o)
CORE_TRANSPORT_OBJ = $(CORE_TRANSPORT_SRC:$(CORE_DIR)/transport/src/%.c=$(OBJ_DIR)/core/transport/%.o)

CORE_OBJECTS = $(CORE_PROTOCOL_APDU_OBJ) $(CORE_PROTOCOL_ASDU_OBJ) \
               $(CORE_CONTROL_VALIDATOR_OBJ) $(CORE_CONTROL_STATEMACHINE_OBJ) $(CORE_CONTROL_TIMEOUT_OBJ) \
               $(CORE_CONTROL_SEQUENCE_OBJ) $(CORE_CONTROL_CONNECTION_OBJ) \
               $(CORE_DATA_TELEMETRY_OBJ) $(CORE_DATA_ANALOG_OBJ) $(CORE_DATA_CONTROL_OBJ) \
               $(CORE_DATA_ENERGY_OBJ) $(CORE_DATA_PULSE_OBJ) $(CORE_DATA_SYSTEM_OBJ) \
               $(CORE_TRANSFER_FILE_OBJ) $(CORE_TRANSFER_UPGRADE_OBJ) $(CORE_PARAMETER_OBJ) \
               $(CORE_UTILS_OBJ) $(CORE_ERROR_OBJ) $(CORE_TYPES_OBJ) \
               $(CORE_API_OBJ) $(CORE_TRANSPORT_OBJ)

# 第三方库（使用静态链接）
# MQTT库：直接编译源文件（静态链接）
# 包含所有源文件，除了MQTTAsync.c, MQTTAsyncUtils.c, MQTTVersion.c, SSLSocket.c
MQTT_THIRD_SRC = $(filter-out \
                 ../../../third/mqtt/src/MQTTAsync.c \
                 ../../../third/mqtt/src/MQTTAsyncUtils.c \
                 ../../../third/mqtt/src/MQTTVersion.c \
                 ../../../third/mqtt/src/SSLSocket.c, \
                 $(wildcard ../../../third/mqtt/src/*.c))
MQTT_THIRD_OBJECTS = $(MQTT_THIRD_SRC:../../../third/mqtt/src/%.c=$(BUILD_DIR)/mqtt_third/%.o)
MQTT_LIBS = 
# cJSON库：使用静态库
CJSON_LIBS = -L../../../third/cJSON -Wl,-Bstatic -lcjson -Wl,-Bdynamic

# 可执行文件
TARGET = $(BIN_DIR)/iec104_controller_app

# 默认目标
all: directories $(TARGET)

# 创建目录
directories:
	@mkdir -p $(OBJ_DIR) $(BIN_DIR) $(BUILD_DIR)/common $(BUILD_DIR)/mqtt $(BUILD_DIR)/mqtt_third $(BUILD_DIR)/platform

# 编译Controller源文件
$(OBJ_DIR)/%.o: $(SRC_DIR)/%.c
	@echo "编译Controller: $<"
	@mkdir -p $(dir $@)
	$(CC) $(CFLAGS) $(INCLUDES) -c $< -o $@

# 编译Common模块
$(BUILD_DIR)/common/logger.o: $(COMMON_LOGS_SRC)
	@echo "编译Common: $<"
	$(CC) $(CFLAGS) $(INCLUDES) -c $< -o $@

$(BUILD_DIR)/common/cfg_utils.o: $(COMMON_CONFIG_SRC)
	@echo "编译Common: $<"
	$(CC) $(CFLAGS) $(INCLUDES) -c $< -o $@

$(BUILD_DIR)/common/json_utils.o: $(word 1, $(COMMON_JSON_SRC))
	@echo "编译Common: $<"
	$(CC) $(CFLAGS) $(INCLUDES) -c $< -o $@

$(BUILD_DIR)/common/param_parser.o: $(word 2, $(COMMON_JSON_SRC))
	@echo "编译Common: $<"
	$(CC) $(CFLAGS) $(INCLUDES) -c $< -o $@

$(BUILD_DIR)/common/string_utils.o: $(word 1, $(COMMON_UTILS_SRC))
	@echo "编译Common: $<"
	$(CC) $(CFLAGS) $(INCLUDES) -c $< -o $@

$(BUILD_DIR)/common/buffer_utils.o: $(word 2, $(COMMON_UTILS_SRC))
	@echo "编译Common: $<"
	$(CC) $(CFLAGS) $(INCLUDES) -c $< -o $@

$(BUILD_DIR)/common/network_utils.o: $(COMMON_NETWORK_SRC)
	@echo "编译Common: $<"
	$(CC) $(CFLAGS) $(INCLUDES) -c $< -o $@

$(BUILD_DIR)/common/version.o: $(COMMON_VERSION_SRC)
	@echo "编译Common: $<"
	$(CC) $(CFLAGS) $(INCLUDES) -c $< -o $@

# 编译MQTT模块
$(BUILD_DIR)/mqtt/mqtt_client.o: $(word 1, $(MQTT_SRC))
	@echo "编译MQTT: $<"
	$(CC) $(CFLAGS) $(INCLUDES) -c $< -o $@

$(BUILD_DIR)/mqtt/mqtt_config_loader.o: $(word 2, $(MQTT_SRC))
	@echo "编译MQTT: $<"
	$(CC) $(CFLAGS) $(INCLUDES) -c $< -o $@

# 编译平台客户端模块
$(BUILD_DIR)/platform/platform_client.o: $(word 1, $(PLATFORM_SRC))
	@echo "编译平台客户端: $<"
	$(CC) $(CFLAGS) $(INCLUDES) -c $< -o $@

$(BUILD_DIR)/platform/platform_config.o: $(word 2, $(PLATFORM_SRC))
	@echo "编译平台配置: $<"
	$(CC) $(CFLAGS) $(INCLUDES) -c $< -o $@

# 编译Core协议APDU模块
$(OBJ_DIR)/core/protocol/apdu/%.o: $(CORE_DIR)/protocol/apdu/src/%.c
	@echo "编译Core APDU: $<"
	@mkdir -p $(dir $@)
	$(CC) $(CFLAGS) $(INCLUDES) -c $< -o $@

# 编译Core协议ASDU模块
$(OBJ_DIR)/core/protocol/asdu/%.o: $(CORE_DIR)/protocol/asdu/src/%.c
	@echo "编译Core ASDU: $<"
	@mkdir -p $(dir $@)
	$(CC) $(CFLAGS) $(INCLUDES) -c $< -o $@

# 编译Core控制层模块
$(OBJ_DIR)/core/control/validator/%.o: $(CORE_DIR)/control/validator/src/%.c
	@echo "编译Core Control Validator: $<"
	@mkdir -p $(dir $@)
	$(CC) $(CFLAGS) $(INCLUDES) -c $< -o $@

$(OBJ_DIR)/core/control/statemachine/%.o: $(CORE_DIR)/control/statemachine/src/%.c
	@echo "编译Core Control StateMachine: $<"
	@mkdir -p $(dir $@)
	$(CC) $(CFLAGS) $(INCLUDES) -c $< -o $@

$(OBJ_DIR)/core/control/timeout/%.o: $(CORE_DIR)/control/timeout/src/%.c
	@echo "编译Core Control Timeout: $<"
	@mkdir -p $(dir $@)
	$(CC) $(CFLAGS) $(INCLUDES) -c $< -o $@

$(OBJ_DIR)/core/control/sequence/%.o: $(CORE_DIR)/control/sequence/src/%.c
	@echo "编译Core Control Sequence: $<"
	@mkdir -p $(dir $@)
	$(CC) $(CFLAGS) $(INCLUDES) -c $< -o $@

$(OBJ_DIR)/core/control/connection/%.o: $(CORE_DIR)/control/connection/src/%.c
	@echo "编译Core Control Connection: $<"
	@mkdir -p $(dir $@)
	$(CC) $(CFLAGS) $(INCLUDES) -c $< -o $@

# 编译Core数据层模块
$(OBJ_DIR)/core/data/telemetry/%.o: $(CORE_DIR)/data/telemetry/src/%.c
	@echo "编译Core Data Telemetry: $<"
	@mkdir -p $(dir $@)
	$(CC) $(CFLAGS) $(INCLUDES) -c $< -o $@

$(OBJ_DIR)/core/data/analog/%.o: $(CORE_DIR)/data/analog/src/%.c
	@echo "编译Core Data Analog: $<"
	@mkdir -p $(dir $@)
	$(CC) $(CFLAGS) $(INCLUDES) -c $< -o $@

$(OBJ_DIR)/core/data/control/%.o: $(CORE_DIR)/data/control/src/%.c
	@echo "编译Core Data Control: $<"
	@mkdir -p $(dir $@)
	$(CC) $(CFLAGS) $(INCLUDES) -c $< -o $@

$(OBJ_DIR)/core/data/energy/%.o: $(CORE_DIR)/data/energy/src/%.c
	@echo "编译Core Data Energy: $<"
	@mkdir -p $(dir $@)
	$(CC) $(CFLAGS) $(INCLUDES) -c $< -o $@

$(OBJ_DIR)/core/data/pulse/%.o: $(CORE_DIR)/data/pulse/src/%.c
	@echo "编译Core Data Pulse: $<"
	@mkdir -p $(dir $@)
	$(CC) $(CFLAGS) $(INCLUDES) -c $< -o $@

$(OBJ_DIR)/core/data/system/%.o: $(CORE_DIR)/data/system/src/%.c
	@echo "编译Core Data System: $<"
	@mkdir -p $(dir $@)
	$(CC) $(CFLAGS) $(INCLUDES) -c $< -o $@

# 编译Core传输层模块
$(OBJ_DIR)/core/transfer/file/%.o: $(CORE_DIR)/transfer/file/src/%.c
	@echo "编译Core Transfer File: $<"
	@mkdir -p $(dir $@)
	$(CC) $(CFLAGS) $(INCLUDES) -c $< -o $@

$(OBJ_DIR)/core/transfer/upgrade/%.o: $(CORE_DIR)/transfer/upgrade/src/%.c
	@echo "编译Core Transfer Upgrade: $<"
	@mkdir -p $(dir $@)
	$(CC) $(CFLAGS) $(INCLUDES) -c $< -o $@

# 编译Core参数模块
$(OBJ_DIR)/core/parameter/%.o: $(CORE_DIR)/parameter/src/%.c
	@echo "编译Core Parameter: $<"
	@mkdir -p $(dir $@)
	$(CC) $(CFLAGS) $(INCLUDES) -c $< -o $@

# 编译Core工具模块
$(OBJ_DIR)/core/common/utils/%.o: $(CORE_DIR)/common/utils/src/%.c
	@echo "编译Core Utils: $<"
	@mkdir -p $(dir $@)
	$(CC) $(CFLAGS) $(INCLUDES) -c $< -o $@

$(OBJ_DIR)/core/common/error/%.o: $(CORE_DIR)/common/error/src/%.c
	@echo "编译Core Error: $<"
	@mkdir -p $(dir $@)
	$(CC) $(CFLAGS) $(INCLUDES) -c $< -o $@

$(OBJ_DIR)/core/common/types/%.o: $(CORE_DIR)/common/types/src/%.c
	@echo "编译Core Types: $<"
	@mkdir -p $(dir $@)
	$(CC) $(CFLAGS) $(INCLUDES) -c $< -o $@

# 编译Core API模块
$(OBJ_DIR)/core/api/%.o: $(CORE_DIR)/api/src/%.c
	@echo "编译Core API: $<"
	@mkdir -p $(dir $@)
	$(CC) $(CFLAGS) $(INCLUDES) -c $< -o $@

# 编译Core传输模块
$(OBJ_DIR)/core/transport/%.o: $(CORE_DIR)/transport/src/%.c
	@echo "编译Core Transport: $<"
	@mkdir -p $(dir $@)
	$(CC) $(CFLAGS) $(INCLUDES) -c $< -o $@

# 编译Drivers模块
$(BUILD_DIR)/drivers/transport_net.o: ../../../drivers/net/src/transport_net.c
	@echo "编译Driver Net: $<"
	@mkdir -p $(dir $@)
	$(CC) $(CFLAGS) $(INCLUDES) -c $< -o $@

$(BUILD_DIR)/drivers/transport_net_config.o: ../../../drivers/net/src/transport_net_config.c
	@echo "编译Driver Net Config: $<"
	@mkdir -p $(dir $@)
	$(CC) $(CFLAGS) $(INCLUDES) -c $< -o $@

# 编译MQTT第三方库源文件
$(BUILD_DIR)/mqtt_third/%.o: ../../../third/mqtt/src/%.c
	@echo "编译MQTT第三方库: $<"
	@mkdir -p $(dir $@)
	$(CC) $(CFLAGS) -D_GNU_SOURCE \
	      -Wno-unused-parameter -Wno-sign-compare -Wno-stringop-truncation \
	      -I../../../third/mqtt/src -I../../../third/mqtt/build -DPAHO_MQTT_STATIC -c $< -o $@

# 链接可执行文件
$(TARGET): $(CONTROLLER_OBJECTS) $(COMMON_OBJECTS) $(MQTT_OBJECTS) $(MQTT_THIRD_OBJECTS) $(PLATFORM_OBJECTS) $(CORE_OBJECTS) $(DRIVER_NET_OBJECTS)
	@echo "链接: $@"
	$(CC) $(LDFLAGS) -o $@ $^ $(MQTT_LIBS) $(CJSON_LIBS) -lpthread -lm -luuid

# 清理
clean:
	@echo "清理构建文件..."
	rm -rf $(BUILD_DIR)

# 安装
install: $(TARGET)
	@echo "安装控制器程序..."
	@mkdir -p ../../../output
	@cp $(TARGET) ../../../output/iec104_controller_app
	@cp config/*.conf ../../../output/ 2>/dev/null || true
	@cp ../../../app/iotplatform/config/platform.conf ../../../output/platform.conf 2>/dev/null || true
	@chmod +x ../../../output/iec104_controller_app
	@echo "控制器程序安装完成"
	@echo "  可执行文件: output/iec104_controller_app"
	@echo "  配置文件: output/iec104_controller.conf"
	@echo "  平台配置: output/platform.conf"

# 运行
run: $(TARGET)
	@echo "运行IEC 104控制器应用..."
	$(TARGET) -c config/iec104_controller.conf

# 帮助信息
help:
	@echo "IEC 104协议控制器应用构建系统"
	@echo "============================"
	@echo "可用目标:"
	@echo "  all      - 构建应用（默认）"
	@echo "  install  - 安装程序到output目录"
	@echo "  clean    - 清理构建文件"
	@echo "  run      - 运行应用"
	@echo "  help     - 显示此帮助信息"

.PHONY: all directories install clean run help
